#!/usr/bin/perl -w
use strict;
use Data::Dumper;

my %h1 = ( "one"   => 1, "two"   => 2, "three" => 3,   );
my %h2 = (  "four"  => 4, "five"  => 5, "six"   => 6, "one"   => 2);
foreach my $x ( keys %h2 ){
    if( exists $h1{ $x } ) {
        $h1{ $x } = $h1{ $x } > $h2{ $x } ? $h1{ $x }:$h2{ $x };
    }
    else {
        $h1{ $x } = $h2{ $x };
    }
}
print Dumper (\%h1);